<template>
  <div>
    <h2>父向子传值</h2>
    <input type="button" value="更新数据" @click="myUpdate">
    <input type="button" value="清空数据" @click="clear">
    <input type="button" value="销毁组件" @click="myDestory">
    <input type='text' v-model = 'name' />
    <hr>
<!--  引入子组件，向子组件传值  -->
    <len1 :msg="name"></len1>
  </div>
</template>

<script>
  import len1 from './Lean1'
  export default {
    name: "test",
    components:{
      len1
    },
    data(){
      return{
        name:'123'
      }
    },
    destroyed() {
      console.log('demo.vue 销毁!!')
    },

    methods: {

      myUpdate(){
        this.name +='!';
      },
      clear(){
        this.name = '';

      },
      myDestory(){
        len1.destroyed();
        this.$destroy();
      }

    }
  }
</script>

<style scoped>

</style>
